import { title } from 'process'
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
	history: createWebHistory(import.meta.env.BASE_URL),
	routes: [
		{
			path: '/',
			name: 'Index',
			redirect: '/home',
			component: () => import("@/views/index.vue"),
			children: [
				{
					path: '/home',
					name: 'Home',
					component: () => import('@/views/home/index.vue'),
					meta: { title: '首页' }
				},
				{
					path: '/user',
					name: 'User',
					component: () => import('@/views/user/index.vue'),
					meta: { title: '用户管理' }
				},
				{
					path: '/perm',
					name: 'Perm',
					component: () => import('@/views/perm/index.vue'),
					meta: { title: '权限管理' }
				},
				{
					path: '/role',
					name: 'Role',
					component: () => import('@/views/role/index.vue'),
					meta: { title: '角色管理' }
				},
				{
					path: '/docker',
					name: 'Docker',
					redirect: { name: "DockerInstance" },
					meta: { title: 'Docker管理' },
					children: [
						{
							path: 'instance',
							name: 'DockerInstance',
							component: () => import('@/views/docker/instance/index.vue'),
							meta: { title: '实例管理' }
						},
						{
							"path": 'container',
							"name": 'DockerContainer',
							component: () => import('@/views/docker/container/index.vue'),
							meta: { title: '容器管理' }
						},
						{
							"path": 'image',
							"name": 'DockerImage',
							component: () => import('@/views/docker/image/index.vue'),
							meta: { title: '镜像管理' }
						},
					]
				},
				{
					"path": '/code',
					"name": 'OnlineCode',
					redirect: { name: "OnlineCodeEnvironment" },
					meta: { title: '在线编程' },
					children: [
						{
							path: "environment",
							name: "OnlineCodeEnvironment",
							component: () => import('@/views/code/environment/index.vue'),
							meta: { title: '环境管理' }
						},
					]
				},
				{
					path: '/community',
					name: 'Community',
					children: [
						{
							path: 'list',
							name: 'CommunityList',
							component: () => import('@/views/community/list/index.vue')
						}
					]
				},
				{
					path: '/ai',
					name: 'Ai',
					redirect: { name: "Ai" },
					meta: { title: 'Ai管理' },
					children: [
						{
							path: 'model',
							name: 'AiModel',
							component: () => import('@/views/ai/model/index.vue'),
							meta: { title: '模型管理' }
						},
						{
							"path": 'prompt',
							"name": 'AiPrompt',
							component: () => import('@/views/ai/prompt/index.vue'),
							meta: { title: '提示词管理' }
						},
						{
							"path": 'knowledge',
							"name": 'AiKnowledge',
							component: () => import('@/views/ai/knowledge/index.vue'),
							meta: { title: '知识库管理' }
						},
					]
				},
				{
					path: "/system/version",
					name: "SystemVersion",
					component: () => import('@/views/system/version/index.vue')
				},
				{
					path: "/system/notice",
					name: "SystemNotice",
					component: () => import('@/views/system/notice/index.vue')
				},
				{
					path: "/system/tag",
					name: "SystemTag",
					component: () => import('@/views/system/tag/index.vue')
				},
				{
					path: "/subject",
					name: "Subject",
					redirect: { name: "Subject" },
					children: [
						{
							path: "list",
							name: "SubjectList",
							component: () => import("@/views/subject/list/index.vue")
						},
					]
				}
			]
		},
		{
			path: '/login',
			name: 'Login',
			component: () => import('@/views/auth/login/index.vue'),
		}
	],
})

export default router
